package com.yangmao.service.impl;

import com.github.pagehelper.PageHelper;
import com.yangmao.dao.WorkPeopleDao;
import com.yangmao.entity.WorkPeople;
import com.yangmao.service.api.WorkPeopleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ‘洋毛’
 * @version 1.0
 * @description: TODO
 * @date 2022/1/5 22:11
 */
@Service
public class WorkPeopleServiceImpl implements WorkPeopleService {

    @Autowired
    private WorkPeopleDao workPeopleDao;

    @Override
    public List<WorkPeople> getAllWorkPeople(int page,int size) {
        PageHelper.startPage(page,size);
        return workPeopleDao.getAllWorkPeople();
    }

    @Override
    public WorkPeople getWorkPeopleById(String id) {
        return workPeopleDao.getWorkPeopleById(id);
    }

    @Override
    public void updateWorkPeople(WorkPeople workPeople) {
        workPeopleDao.updateWorkPeople(workPeople);
    }

    @Override
    public void deleteWorkPeopleById(String id) {
        workPeopleDao.deleteWorkPeopleById(id);
    }

    @Override
    public void addWorkPeople(WorkPeople workPeople) {
        workPeopleDao.addWorkPeople(workPeople);
    }

    @Override
    public List<WorkPeople> getWorkPeopleByIdAndPosition(String id, String position,int page,int size) {
        PageHelper.startPage(page,size);
        return workPeopleDao.getWorkPeopleByIdAndPosition(id,position);
    }
}
